<?php
	include "common.php";
	session_start();
	error_reporting(0);
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$ID = $_SESSION['id'];
	$supervisor = $_SESSION['supervisor'];
	$userFname = $_SESSION['userFname'];
	$userLname = $_SESSION['userLname'];
	$role = $_SESSION['role'];
	$userLink = $_SESSION['userLink'];
	
	$meetingEvent = $_POST['event'];
	$meetingDay = $_POST['day'];
	$meetingMonth = $_POST['month'];
	$meetingYear = $_POST['year'];
	$meetingDay1 = $_POST['day1'];
	$meetingMonth1 = $_POST['month1'];
	$meetingYear1 = $_POST['year1'];
	$meetingPlace = $_POST['place'];
	$meetingWithWhom = $_POST['whom'];
	$meetingReason = $_POST['reason'];
	$isCheckSubmit = $_POST['isCheck'];
	
	$meetingDateFrom = $meetingYear."-".$meetingMonth."-".$meetingDay;
	$meetingDateTo = $meetingYear1."-".$meetingMonth1."-".$meetingDay1;
	
	
		$sqlInsert = "INSERT INTO apply_for_meeting (e_id,event,date_from,date_to,place,whom,reason,approval,supervisor,is_delete,status)
			VALUES ('$ID','$meetingEvent','$meetingDateFrom','$meetingDateTo','$meetingPlace','$meetingWithWhom','$meetingReason','2','$supervisor','0','2')";
		$sqlInsertQuery = mysql_query($sqlInsert);
		
		$applyMeeting = "SELECT * FROM apply_for_meeting WHERE e_id = '$ID'";
		$applyMeetingSql = mysql_query($applyMeeting);
		$applyMeetingSqlResult = mysql_fetch_assoc($applyMeetingSql);
		
		$idofapplyMeeting = $applyMeetingSqlResult['id'];
		
		$notificationSql = "INSERT INTO notification (reference_id,e_id,supervisor,Type,Reason,Status)
			VALUES ('$idofapplyMeeting','$ID','$supervisor','apply_for_meeting','$meetingReason','2')";
		$notificationSqlResult = mysql_query($notificationSql);
		
		$notificationSelectSql = "SELECT * FROM user WHERE e_id = '$supervisor'";
		$notificationSelectSqlQuery = mysql_query($notificationSelectSql);
		$notificationSelectSqlQueryResult = mysql_fetch_assoc($notificationSelectSqlQuery);
		
		$notification = $notificationSelectSqlQueryResult['notification'];
		$notification++;
		
		$updateNotificationSql = "UPDATE user SET notification = '$notification' WHERE e_id = '$supervisor'";
		$updateNotificationSqlQuery = mysql_query($updateNotificationSql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="emp_index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="show_report.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<ul>
        	
        	<a href="employee.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="work_night.php" class="active"><li><div id="employee"></div><p>Work At Night</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="emp_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="emp_leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="emp_black_box.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
        </ul>
    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>Apply For: <a href="work_night.php?check=1">Work At Night</a> | <a href="work_night.php?check=2">Meeting</a> | 
	<a href="work_night.php?check=3">Medical Doc</a></p>
</div><!-- end of othrpage_1-->
    <div class="page_content" style="font-family:Verdana, Geneva, Tahoma, sans-serif; margin:0px !important">
		<p style="font-size:18px; text-align:center; color:#333536;">Thank you Very Much For Sending Message</p>
		<p style="font-size:18px; text-align:center; color:#333536;">He Will Be Notified Shortly</p>
		
    </div><!-- end of page_content -->
</div><!-- end of main_div-->
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->

</body>
</html>

